home comics writing pictures archive about

Line.cpp

Language: C++
Last Modified: 2021-10-23 9:51:06 PM UTC
File Size: 1328 bytes
http://www.penguinstew.ca/example/CodeFormater/Line.cpp
#include "Line.h"
#include <sstream>
Line::Line(int number, std::string content)
{
this->number = number;
this->content = content;
}
int Line::GetNumber()
{
return this->number;
}
std::string Line::GetContent()
{
return this->content;
}
std::string Line::ToString()
{
std::stringstream stream;
stream << "lineNumber: ";
stream << "number: " << this->number << " ";
stream << "content: " << this->content << " ";
return stream.str();
}
std::string Line::FormatNumber(bool first)
{
std::stringstream stream;
stream << "\t\t<div class=\"";
if (first)
{
stream << "codeCountRowFirst";
}
else
{
stream << "codeCountRow";
}
stream << "\">" << std::endl;
stream << "\t\t\t<div class=\"codeCountCell2\">";
stream << this->number;
stream << "</div>" << std::endl;
stream << "\t\t</div>" << std::endl;
return stream.str();
}
std::string Line::FormatContent(bool first)
{
std::stringstream stream;
stream << "\t\t<div class=\"";
if (first)
{
stream << "codeTextRowFirst";
}
else
{
stream << "codeTextRow";
}
stream << "\">" << std::endl;
stream << "\t\t\t<div class=\"codeTextCell2\">";
stream << this->content;
stream << "</div>" << std::endl;
stream << "\t\t</div>" << std::endl;
return stream.str();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73